/*******************************************************************************
* Purpose: Adds restricted data on outcomes at ages 5,8 and 18
* 
* Dependencies:
*   Input: ihdp_data_0-3.dta (publicly available)
*   Output: ihdp_data.dta
*
* Notes: -
*******************************************************************************/
set more off
clear all

global storage: env storage
global data_hub: env data_hub

use "$storage/ece_parenting/clean_data/ihdp_data_0-3.dta"
rename *, upper

// add restricted data
merge 1:1 IHDP using "$data_hub/ece_parenting/14827472/ICPSR_23580/DS0001/23580-0001-Data-REST.dta", force
drop ICPSR_ID SITE_NUM MATED RACE NHIBW F3AMAGE _merge

order WORK5 HS5 COLLGR5 SMOKE5 ACTVTY5 LITERACY5 BOOKS5 TVSAGE5 DICTION5 TPHYSFU5 TMHEALT5 TGHP5 TPAIN5 TSOCFUN5 TROLEF5 MENTAL5 OUTINGS5 MOM5 WEIGHT5 WORK8 HSGED8 COLLGR8 EDUCASP8 PCS8 MCS8 MENTAL8 CONTROL AUTHOR DEMOCRAT YELLAGE8 COHES8 CONF8 MOM8 CUMMOM8 FSIQ8 PPVTSTD8 WJBRSS8 WJBMSS8 CBCL_TOTAL WEIGHT8 WORK18 HSGED18 COLLGR18 MATCONN SCHLMTG MATSCHL EDUCASP PCS MCS MENTAL18 COHES18 CONF18 NOWSMOKE SUPERVC YELL4WKS MOM18 CUMMOM18 PPVTSTD WJBRSS WJBMSS TBPISELF YRBSS WASIFSIQ TBPICAR PCS12 PCS_YA FE ETS WEIGHT18 KIDPPVT5 WIPPSIF5, after(CUM_AVG_DAYCARE_36M_SUM)
rename *, lower

// add restricted data
merge 1:1 ihdp using "$data_hub/ece_parenting/adultihdp.dta"
drop _merge

// keep primary sample
keep if pag == 1
